<?php

/*
 * Records a new user
 * Mamdouh Alharbi 21\1\2013
 */

class U_User
{
    public $insertUser;
    public $insertedLoginData;
    public $insertedAdminData;
    
    public function __construct()
    {
         $this->insertUser = true;
         $this->insertedAdminData = true;
    }
    //Insert student data
    public function inserUser($firstName,$fatherName,$familyName,$username,
            $password,$email)
    {
        include("../../Common/Model/DBConnection.php");
        $DB = new DB_Connection();
        $DB->connect(); 
        //insert admin data to admin_data table
        $this->insertedAdminData = mysql_query("INSERT INTO admin_data
          (first_name,father_name, grandfather_name, email, username,status,password) VALUES
          ('$firstName', '$fatherName', '$familyName','$email','$username',1,'$password')");
        //to show a message if inserting is not done 
        if(!$this->insertedAdminData){
            $this->insertUser=false;
        }
       //Disconnect DB connection
       $DB->disconnect();
    }
}
?>
